import 'dart:convert';
import 'dart:io';

import 'package:ecy_app_flutter/EcyRouter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:image_picker/image_picker.dart';

import '../../../ecycommon/EcyCommonWidgets.dart';
import '../../../ecycommon/EcyRequestBaseManager.dart';
import '../../../ecycommon/utils/EcyUserUtil.dart';
import '../../../model/EcyApiCommonPage.dart';
import '../../../model/EcyApiCommonResponse.dart';
import '../../../model/EcyLocationModel.dart';

class EcyAfterSaleDetailPage extends EcyCommonBaseWidget {
  EcyAfterSaleDetailPage({required super.key});

  @override
  _EcyAfterSaleDetailPageState createState() {
    return _EcyAfterSaleDetailPageState(this);
  }
}

class _EcyAfterSaleDetailPageState extends EcyCommonBaseWidgetState {
  late EcyCommonBaseWidget controller;

  _EcyAfterSaleDetailPageState(EcyCommonBaseWidget vc) {
    controller = vc;
  }

  TextEditingController _otherController = TextEditingController();
  TextEditingController _supplementController = TextEditingController();

  int? _selectedReturnReasonRadioValue;
  int? _selectedSendMethodRadioValue;
  String? returnReason;
  String? sendMethod;

  Map<int, String> returnReasonMap = {
    0: '包装/商品破损/污渍/裂痕/变形',
    1: '收到商品少件（含少配件）',
    2: '商品发错货',
    3: '其他',
  };

  Map<int, String> sendMethodMap = {
    0: '上门取件',
    1: '快递柜寄件',
    2: '自行寄回',
  };

  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    // 清理控制器，避免内存泄漏
    _otherController.dispose();
    _supplementController.dispose();
    super.dispose();
  }

  @override
  Future<void> requestData({int pageIndex = 1, int type = 0}) async {
    super.requestData();
    bool logined = await EcyUserUtil.logined();
    Map<String, dynamic> body = {
      "pageSize": 50,
      "pageIndex": pageIndex,
      "type": type
    };
    var response =
        await EcyRequestbasemanager().get("/app/api/app/user/address/list", body);
    print("response" + response.toString());

    if (response != null) {
      var _respModel =
          EcyApiCommonResponse.fromJson(response, (response) => json);
      if (_respModel.code == 0 || _respModel.code == 200) {
        EcyApiCommonPage<EcyLocationModel> _modelPage =
            EcyApiCommonPage.fromJson(
                response["data"], (json) => EcyLocationModel.fromJson(json));
        setState(() {});
      }
    }
  }

  final ImagePicker _picker = ImagePicker();
  File? _image;

  Future<void> _pickImage() async {
    final pickedFile =
        await _picker.pickImage(source: ImageSource.gallery); // 从相册选择图片
    // final pickedFile = await _picker.pickImage(source: ImageSource.camera); // 从相机选择图片
    setState(() {
      if (pickedFile != null) {
        _image = File(pickedFile.path);
      }
    });
  }

  // 弹出对话框
  Future<bool?> showDeleteConfirmDialog(String content) {
    return showDialog<bool>(
      context: context,
      builder: (context) {
        return AlertDialog(
          // title: const Text(''),
          contentPadding: const EdgeInsets.all(0),
          backgroundColor: Colors.white,
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(8.0),
          ),
          content: SizedBox(
            height: 130,
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Padding(
                  padding: const EdgeInsets.only(top: 20, bottom: 30),
                  child: Text(
                    content,
                    style: TextStyle(fontSize: 18),
                  ),
                ),
                const Divider(height: 0, color: Color(0XFFdcdcdc)),
                SizedBox(
                  height: 50,
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: <Widget>[
                      Expanded(
                        flex: 1,
                        child: DecoratedBox(
                          decoration: const BoxDecoration(
                              border: Border(
                            right: BorderSide(
                              width: 1.0,
                              color: Color(0XFFdcdcdc),
                            ),
                          )),
                          child: TextButton(
                            style: const ButtonStyle(
                              alignment: Alignment.center,
                            ),
                            child: Text(
                              '取消',
                              style: const TextStyle(
                                  fontSize: 18, color: Colors.black),
                            ),
                            onPressed: () =>
                                Navigator.of(context).pop(), // 关闭对话框
                          ),
                        ),
                      ),
                      Expanded(
                        flex: 1,
                        child: TextButton(
                          child: Text(
                            '确认',
                            style: const TextStyle(
                                fontSize: 18, color: Color(0xFFEA4B9B)),
                          ),
                          onPressed: () {
                            //关闭对话框并返回true
                            Navigator.of(context).pop(true);
                          },
                        ),
                      ),
                    ],
                  ),
                ),
              ],
            ),
          ),
          actionsAlignment: MainAxisAlignment.spaceAround,
          actionsPadding: const EdgeInsets.all(0),
        );
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    Widget image = Image.asset('assets/images/erciyuan.jpg', width: 80);

    return Scaffold(
      backgroundColor: const Color(0xFFF5F5F5),
      appBar: AppBar(
        backgroundColor: Colors.white,
        title: const Text(
          '申请售后',
          style: TextStyle(fontSize: 18),
        ),
        centerTitle: true,
      ),
      body: SingleChildScrollView(
        child: Padding(
          padding: EdgeInsets.all(8),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Card(
                color: Colors.white,
                elevation: 0,
                child: Padding(
                    padding: const EdgeInsets.only(
                        left: 15, top: 15, right: 15, bottom: 15),
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Row(
                          mainAxisAlignment: MainAxisAlignment.center,
                          children: [
                            Expanded(
                              flex: 2,
                              child: ClipRRect(
                                  borderRadius: BorderRadius.circular(5.0),
                                  child: image),
                            ),
                            Expanded(
                                flex: 7,
                                child: Padding(
                                  padding: EdgeInsets.only(left: 6),
                                  child: Column(
                                    crossAxisAlignment:
                                        CrossAxisAlignment.start,
                                    children: [
                                      Text('黑暗之魂手办',
                                          style: const TextStyle(
                                              fontSize: 16,
                                              color: Colors.black),
                                          maxLines: 1,
                                          overflow: TextOverflow.ellipsis),
                                      const Padding(
                                          padding: EdgeInsets.only(bottom: 2)),
                                      Text('谷子介绍谷子介绍谷子介绍谷子介绍谷子',
                                          style: TextStyle(
                                              fontSize: 12,
                                              color: const Color(0xFF8C8C8C)
                                                  .withOpacity(0.8)),
                                          maxLines: 1,
                                          overflow: TextOverflow.ellipsis),
                                      const Padding(
                                          padding: EdgeInsets.only(bottom: 15)),
                                      Row(
                                        children: [
                                          Expanded(
                                            flex: 1,
                                            child: Text(
                                              '￥49.00',
                                              style: const TextStyle(
                                                  fontSize: 16,
                                                  color: Colors.black),
                                            ),
                                          ),
                                          Expanded(
                                            flex: 3,
                                            child: Align(
                                              alignment: Alignment.centerRight,
                                              child: Text(
                                                'x2',
                                                style: const TextStyle(
                                                    fontSize: 14,
                                                    color: Color(0xFF8C8C8C)),
                                              ),
                                            ),
                                          ),
                                        ],
                                      )
                                    ],
                                  ),
                                )),
                          ],
                        ),
                      ],
                    )),
              ),
              Padding(padding: EdgeInsets.only(bottom: 3)),
              Card(
                color: Colors.white,
                elevation: 0,
                margin: EdgeInsets.only(left: 4, top: 0, right: 4, bottom: 1),
                child: ListTile(
                  leading: Text(
                    '换货原因',
                    style: TextStyle(color: Colors.black, fontSize: 16),
                  ),
                  title: Text(
                    returnReasonMap[_selectedReturnReasonRadioValue] ?? '请选择',
                    style: TextStyle(color: Colors.grey, fontSize: 16),
                  ),
                  trailing: const Icon(Icons.arrow_forward_ios, size: 14),
                  splashColor: Colors.transparent,
                  contentPadding: EdgeInsets.only(left: 16, right: 12),
                  onTap: () {
                    _showModalBottomSheet(context);
                  },
                ),
              ),
              Padding(padding: EdgeInsets.only(bottom: 3)),
              Card(
                color: Colors.white,
                elevation: 0,
                margin: EdgeInsets.only(left: 4, top: 4, right: 4, bottom: 1),
                child: ListTile(
                  leading: Text(
                    '寄件方式',
                    style: TextStyle(color: Colors.black, fontSize: 16),
                  ),
                  title: Text(
                    sendMethodMap[_selectedSendMethodRadioValue] ?? '请选择',
                    style: TextStyle(color: Colors.grey, fontSize: 16),
                  ),
                  trailing: const Icon(Icons.arrow_forward_ios, size: 14),
                  splashColor: Colors.transparent,
                  contentPadding: EdgeInsets.only(left: 16, right: 12),
                  onTap: () {
                    _showSendMethodModalBottomSheet(context);
                  },
                ),
              ),
              Card(
                color: Colors.white,
                elevation: 0,
                margin: EdgeInsets.only(left: 4, top: 0, right: 4, bottom: 1),
                child: ListTile(
                  leading: Text(
                    '取件时间',
                    style: TextStyle(color: Colors.black, fontSize: 16),
                  ),
                  title: Text(
                    '请选择',
                    style: TextStyle(color: Colors.grey, fontSize: 16),
                  ),
                  trailing: const Icon(Icons.arrow_forward_ios, size: 14),
                  splashColor: Colors.transparent,
                  contentPadding: EdgeInsets.only(left: 16, right: 12),
                  onTap: () {},
                ),
              ),
              Card(
                color: Colors.white,
                elevation: 0,
                margin: EdgeInsets.only(left: 4, top: 0, right: 4, bottom: 1),
                child: ListTile(
                  leading: Text(
                    '快递柜',
                    style: TextStyle(color: Colors.black, fontSize: 16),
                  ),
                  title: Text(
                    '江苏省南京市',
                    style: TextStyle(color: Colors.grey, fontSize: 16),
                  ),
                  trailing: const Icon(Icons.arrow_forward_ios, size: 14),
                  splashColor: Colors.transparent,
                  contentPadding: EdgeInsets.only(left: 16, right: 12),
                  onTap: () {},
                ),
              ),
              Card(
                color: Colors.white,
                elevation: 0,
                margin: EdgeInsets.only(left: 4, top: 0, right: 4, bottom: 1),
                child: ListTile(
                  title: RichText(
                      text: TextSpan(children: [
                    WidgetSpan(
                        alignment: PlaceholderAlignment.bottom,
                        child: Container(
                          width: 20,
                          height: 20,
                          color: Color(0xFFfff0f5),
                          child: Center(
                            child: Text(
                              '寄',
                              style: TextStyle(
                                  fontSize: 14, color: Color(0xFFEA4B9B)),
                            ),
                          ),
                        )),
                    const TextSpan(
                      text: '  李思  15061004358',
                      style: TextStyle(color: Colors.black, fontSize: 16),
                    ),
                  ])),
                  subtitle: Text(
                    '江苏省南京市建邺区银杏大道',
                    style: TextStyle(color: Colors.grey, fontSize: 16),
                  ),
                  trailing: const Icon(Icons.arrow_forward_ios, size: 14),
                  splashColor: Colors.transparent,
                  contentPadding: EdgeInsets.only(left: 16, right: 12),
                  onTap: () {},
                ),
              ),
              Padding(padding: EdgeInsets.only(bottom: 8)),
              Card(
                color: Colors.white,
                elevation: 0,
                margin: EdgeInsets.only(left: 4, top: 0, right: 4, bottom: 0),
                child: Padding(
                  padding: EdgeInsets.all(16),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text('补充说明',
                          style: TextStyle(color: Colors.black, fontSize: 16)),
                      // Padding(padding: EdgeInsets.only(top: 4)),
                      TextField(
                          controller: _supplementController,
                          maxLines: 3,
                          maxLength: 500,
                          maxLengthEnforcement:
                              MaxLengthEnforcement.truncateAfterCompositionEnds,
                          keyboardType: TextInputType.multiline,
                          decoration: InputDecoration(
                            counterText: '',
                            hintText: "在此描述详细情况",
                            hintStyle: const TextStyle(
                              color: Colors.grey,
                              fontSize: 16,
                            ),
                            border: OutlineInputBorder(
                              borderRadius: BorderRadius.circular(5),
                              borderSide: BorderSide.none,
                            ),
                            //是否填充背景色
                            filled: true,
                            //设置背景色，filled 为 true 时生效
                            fillColor: Colors.white,
                            contentPadding: const EdgeInsets.all(0),
                          )),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text('图片凭证',
                              style:
                                  TextStyle(color: Colors.black, fontSize: 16)),
                          Text('最多8张',
                              style:
                                  TextStyle(color: Colors.grey, fontSize: 14)),
                        ],
                      ),
                      Padding(
                        padding: EdgeInsets.only(bottom: 5),
                      ),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Flexible(
                            child: SizedBox(
                              height: 60,
                              width: 60,
                              child: DecoratedBox(
                                decoration: BoxDecoration(
                                  border: Border.all(
                                    color: const Color(0XFFc0c0c0), // 边框颜色
                                    width: 1.0, // 边框宽度
                                  ),
                                  borderRadius:
                                      BorderRadius.circular(5.0), // 圆角边框
                                ),
                                child: IconButton(
                                  icon: const Icon(Icons.add),
                                  iconSize: 40,
                                  color: const Color(0XFFc0c0c0),
                                  splashColor: Colors.transparent,
                                  highlightColor: Colors.transparent,
                                  onPressed: () {
                                    _pickImage();
                                  },
                                ),
                              ),
                            ),
                          ),
                          Flexible(
                            child: SizedBox(
                              height: 60,
                              width: 60,
                              child: DecoratedBox(
                                decoration: BoxDecoration(
                                  border: Border.all(
                                    color: const Color(0XFFc0c0c0), // 边框颜色
                                    width: 1.0, // 边框宽度
                                  ),
                                  borderRadius:
                                      BorderRadius.circular(5.0), // 圆角边框
                                ),
                                child: IconButton(
                                  icon: const Icon(Icons.add),
                                  iconSize: 40,
                                  color: const Color(0XFFc0c0c0),
                                  splashColor: Colors.transparent,
                                  highlightColor: Colors.transparent,
                                  onPressed: () {
                                    _pickImage();
                                  },
                                ),
                              ),
                            ),
                          ),
                          Flexible(
                            child: SizedBox(
                              height: 60,
                              width: 60,
                              child: DecoratedBox(
                                decoration: BoxDecoration(
                                  border: Border.all(
                                    color: const Color(0XFFc0c0c0), // 边框颜色
                                    width: 1.0, // 边框宽度
                                  ),
                                  borderRadius:
                                      BorderRadius.circular(5.0), // 圆角边框
                                ),
                                child: IconButton(
                                  icon: const Icon(Icons.add),
                                  iconSize: 40,
                                  color: const Color(0XFFc0c0c0),
                                  splashColor: Colors.transparent,
                                  highlightColor: Colors.transparent,
                                  onPressed: () {
                                    _pickImage();
                                  },
                                ),
                              ),
                            ),
                          ),
                          Flexible(
                            child: SizedBox(
                              height: 60,
                              width: 60,
                              child: DecoratedBox(
                                decoration: BoxDecoration(
                                  border: Border.all(
                                    color: const Color(0XFFc0c0c0), // 边框颜色
                                    width: 1.0, // 边框宽度
                                  ),
                                  borderRadius:
                                      BorderRadius.circular(5.0), // 圆角边框
                                ),
                                child: IconButton(
                                  icon: const Icon(Icons.add),
                                  iconSize: 40,
                                  color: const Color(0XFFc0c0c0),
                                  splashColor: Colors.transparent,
                                  highlightColor: Colors.transparent,
                                  onPressed: () {
                                    _pickImage();
                                  },
                                ),
                              ),
                            ),
                          ),
                        ],
                      )
                    ],
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
      bottomNavigationBar: BottomAppBar(
        color: Colors.white,
        // shape: CircularNotchedRectangle(), // 底部导航栏打一个圆形的洞
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: [
            Expanded(
              flex: 1,
              child: Container(
                height: 40.0,
                padding: const EdgeInsets.only(left: 10),
                child: TextButton(
                    onPressed: () {
                      // TOOD 提交
                    },
                    style: const ButtonStyle(
                      alignment: Alignment.center,
                      backgroundColor:
                          WidgetStatePropertyAll(Color(0xFFEA4B9B)),
                      foregroundColor: WidgetStatePropertyAll(Colors.white),
                    ),
                    child: const Text(
                      '提交',
                      style: TextStyle(
                        height: 1,
                        fontSize: 18,
                        leadingDistribution:
                            TextLeadingDistribution.even, // 设置leading策略
                      ),
                    )),
              ),
            )
          ],
        ),
      ),
    );
  }

  void updateReturnReason(int index){
    setState((){
      _selectedReturnReasonRadioValue = index;
    });
  }

  void _showModalBottomSheet(BuildContext context) {
    showModalBottomSheet(
      isDismissible: true, //点击空白处返回功能，默认是true
      enableDrag: true, //是否允许拖动
      elevation: 10,
      backgroundColor: Colors.white, //背景颜色
      shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.only(
            topLeft: Radius.circular(10),
            topRight: Radius.circular(10),
          ),
      ), //圆角
      context: context,
      builder: (context) => StatefulBuilder(builder: (context, setState) {
        return Container(
          height: 800.h,
          padding: EdgeInsets.only(left: 16, right: 16),
          decoration: BoxDecoration(
            borderRadius: BorderRadius.only(
              topLeft: Radius.circular(30.w),
              topRight: Radius.circular(30.w),
            ),
            color: Colors.white,
          ),
          child: Column(
            children: <Widget>[
              // 标题
              SizedBox(
                height: 65.h,
                child: Center(
                  child: Text(
                    "换货原因",
                    style: TextStyle(
                      fontSize: 16.sp,
                    ),
                  ),
                ),
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text('包装/商品破损/污渍/裂痕/变形', style: TextStyle(color: Colors.black, fontSize: 16)),
                  // 使用 RadioListTile 作为 Radio 的容器
                  GestureDetector(
                    onTap: () => {
                      setState(() {
                        _selectedReturnReasonRadioValue = 0;
                      }),
                    },
                    child: Image(
                        image: AssetImage(_selectedReturnReasonRadioValue == 0
                            ? 'assets/images/login_checked.png'
                            : 'assets/images/login_unchecked.png'),
                        width: 24,
                        height: 24),
                  ),
                ],
              ),
              Padding(padding: EdgeInsets.only(top: 12, bottom: 12)),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text('收到商品少件（含少配件）', style: TextStyle(color: Colors.black, fontSize: 16)),
                  // 使用 RadioListTile 作为 Radio 的容器
                  GestureDetector(
                    onTap: () => {
                      setState(() {
                        _selectedReturnReasonRadioValue = 1;
                      }),
                    },
                    child: Image(
                        image: AssetImage(_selectedReturnReasonRadioValue == 1
                            ? 'assets/images/login_checked.png'
                            : 'assets/images/login_unchecked.png'),
                        width: 24,
                        height: 24),
                  ),
                ],
              ),
              Padding(padding: EdgeInsets.only(top: 12, bottom: 12)),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text('商品发错货', style: TextStyle(color: Colors.black, fontSize: 16)),
                  // 使用 RadioListTile 作为 Radio 的容器
                  GestureDetector(
                    onTap: () => {
                      setState(() {
                        _selectedReturnReasonRadioValue = 2;
                      }),
                    },
                    child: Image(
                        image: AssetImage(_selectedReturnReasonRadioValue == 2
                            ? 'assets/images/login_checked.png'
                            : 'assets/images/login_unchecked.png'),
                        width: 24,
                        height: 24),
                  ),
                ],
              ),
              Padding(padding: EdgeInsets.only(top: 12, bottom: 12)),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text('其他', style: TextStyle(color: Colors.black, fontSize: 16)),
                  // 使用 RadioListTile 作为 Radio 的容器
                  GestureDetector(
                    onTap: () => {
                      setState(() {
                        _selectedReturnReasonRadioValue = 3;
                      }),
                    },
                    child: Image(
                        image: AssetImage(_selectedReturnReasonRadioValue == 3
                            ? 'assets/images/login_checked.png'
                            : 'assets/images/login_unchecked.png'),
                        width: 24,
                        height: 24),
                  ),
                ],
              ),
              Padding(padding: EdgeInsets.only(top: 8)),
              TextField(
                  controller: _otherController,
                  maxLines: 4,
                  maxLength: 500,
                  maxLengthEnforcement:
                      MaxLengthEnforcement.truncateAfterCompositionEnds,
                  keyboardType: TextInputType.multiline,
                  decoration: InputDecoration(
                    counterText: '',
                    hintText: "请补充描述换货理由，以便更好的处理售后请求",
                    hintStyle: const TextStyle(
                      color: Colors.grey,
                      fontSize: 16,
                    ),
                    border: OutlineInputBorder(
                      borderRadius: BorderRadius.circular(5),
                      borderSide: BorderSide.none,
                    ),
                    //是否填充背景色
                    filled: true,
                    //设置背景色，filled 为 true 时生效
                    fillColor: const Color(0xFFF5F5F5),
                    contentPadding: const EdgeInsets.all(10.0),
                  )),
            ],
          ),
        );
      }),
    );
  }

  // 寄件方式
  void _showSendMethodModalBottomSheet(BuildContext context) {
    showModalBottomSheet(
      isDismissible: true, //点击空白处返回功能，默认是true
      enableDrag: true, //是否允许拖动
      elevation: 10,
      backgroundColor: Colors.white, //背景颜色
      shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.only(
        topLeft: Radius.circular(10),
        topRight: Radius.circular(10),
      )), //圆角
      context: context,
      builder: (context) => StatefulBuilder(builder: (context, setState) {
        return Container(
          height: 800.h,
          padding: EdgeInsets.only(left: 16, right: 16),
          decoration: BoxDecoration(
            borderRadius: BorderRadius.only(
              topLeft: Radius.circular(30.w),
              topRight: Radius.circular(30.w),
            ),
            color: Colors.white,
          ),
          child: Column(
            children: <Widget>[
              // 标题
              SizedBox(
                height: 65.h,
                child: Center(
                  child: Text(
                    "寄件方式",
                    style: TextStyle(
                      fontSize: 16.sp,
                    ),
                  ),
                ),
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text('上门取件', style: TextStyle(color: Colors.black, fontSize: 16)),
                  // 使用 RadioListTile 作为 Radio 的容器
                  GestureDetector(
                    onTap: () => {
                      setState(() {
                        _selectedSendMethodRadioValue = 0;
                      }),
                    },
                    child: Image(
                        image: AssetImage(_selectedSendMethodRadioValue == 0
                            ? 'assets/images/login_checked.png'
                            : 'assets/images/login_unchecked.png'),
                        width: 24,
                        height: 24),
                  ),
                ],
              ),
              Padding(padding: EdgeInsets.only(top: 12, bottom: 12)),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text('快递柜寄件', style: TextStyle(color: Colors.black, fontSize: 16)),
                  // 使用 RadioListTile 作为 Radio 的容器
                  GestureDetector(
                    onTap: () => {
                      setState(() {
                        _selectedSendMethodRadioValue = 1;
                      }),
                    },
                    child: Image(
                        image: AssetImage(_selectedSendMethodRadioValue == 1
                            ? 'assets/images/login_checked.png'
                            : 'assets/images/login_unchecked.png'),
                        width: 24,
                        height: 24),
                  ),
                ],
              ),
              Padding(padding: EdgeInsets.only(top: 12, bottom: 12)),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text('自行寄回', style: TextStyle(color: Colors.black, fontSize: 16)),
                      Padding(padding: EdgeInsets.only(bottom: 5)),
                      Text('自行联系快递，填写物流单号', style: TextStyle(color: Colors.grey, fontSize: 14)),
                    ],
                  ),
                  GestureDetector(
                    onTap: () => {
                      setState(() {
                        _selectedSendMethodRadioValue = 2;
                      }),
                    },
                    child: Image(
                        image: AssetImage(_selectedSendMethodRadioValue == 2
                            ? 'assets/images/login_checked.png'
                            : 'assets/images/login_unchecked.png'),
                        width: 24,
                        height: 24),
                  ),
                ],
              ),
            ],
          ),
        );
      }),
    );
  }
}
